#pragma once

#include "Player.h"
#include "RegUtils.h"
#include "TopMessage.h"

using namespace std;

class Top
{
protected:
	vector<Player> mElements;
	unsigned long mLowerPont;
	unsigned long mHigherPont;

	HANDLE mElementsSem;

protected:
	void UpdateBounds(bool _broadcastUpdates = true);

	static bool Order(Player& _p1, Player& _p2);

public:
	Top(void);
	~Top(void);

	virtual void Load() = 0;
	virtual void Save() = 0;
	virtual void AddElement(Player _newPlayer){};
	virtual void Update(Player& _player, bool _broadcastUpdates = true) = 0;
	virtual TopMessage* GetMessage() = 0;

	void RemoveElement(Player& _player);
	bool ElementExists(Player& _player);

	void Reset();

public:
	vector<Player> GetElements();
};

